import {
  Body,
  Controller,
  Get,
  HttpStatus,
  Param,
  Post,
  Response,
} from '@nestjs/common';
import { CreateUsersDto } from './DTO/create-users.dto';

@Controller('users')
export class UsersController {
  @Get()
  getAllUsers(@Response() res) {
    const users = [{ name: 'Fniu', age: 25 }];
    res.status(HttpStatus.OK).json(users);
  }

  @Get('/:id')
  getUser(@Param() params) {
    return { getUsersId: params.id };
  }

  @Post()
  addUser(@Body() createUserDTO: CreateUsersDto) {
    console.log(`${createUserDTO._name} - ${createUserDTO._age}`);
  }
}
